from django.db import models

# Create your models here.
class Author(models.Model):
    name = models.CharField(max_length=100)
    desc = models.CharField(max_length=20)

    def __str__(self):
        return self.name
    class Meta:
        db_table = 'author'

class Message(models.Model):
    title = models.CharField(max_length=10)
    content = models.CharField(max_length=100)
    au = models.ForeignKey(Author, on_delete=models.CASCADE)
    author = models.CharField(max_length=10)
    read = models.IntegerField(default=0)
    mes = models.IntegerField(default=0)
    add_time = models.DateTimeField(auto_now_add=True)
    is_show = models.BooleanField(default=False)
    def __str__(self):
        return self.title
    class Meta:
        db_table = 'message'